<?php
namespace Home\Controller;
use Think\Controller;
use Think\Page;

class ArticleController extends CommonController {
    
	
	public function index(){

		$this->activity();
    }
    
	public function activity(){

		$art = M('Article');
		
		$artlist = $art-> where('artcate_id=1')-> limit(50)->order('id desc')->select();
		$this->assign('data',$artlist);
		
		$this->display(CONTROLLER_NAME.'/news');
    }
    
	public function news(){

		$art = M('Article');
		
		$artlist = $art-> where('artcate_id!=1')-> limit(50)->order('id desc')->select();
		$this->assign('data',$artlist);
		
		$this->display(CONTROLLER_NAME.'/news');
    }
    
	public function shownews(){

		$id=$_GET['id'];
		$m=M(CONTROLLER_NAME);
		$arr=$m->find($id);
		$this->assign('data',$arr);
		
		$this->assign('nowtime',time());
		
		$this->display(CONTROLLER_NAME.'/show');
    }
    
	public function joinAct(){
    	$m = D('ActLog');
    	
		if(!$m->create()){
			$this->error($m->getError());
		}
		$idNum=$m->add();
		if($idNum>0){
			$this->show('ok');
		}else{
			$this->show('error');
		}
		
		
		
    }
    
		
}